<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    >
  <SolidColorBrush x:Key="IconBrush" Color="White"/>
  <ControlTemplate x:Key="SpecialButton" TargetType="{x:Type Button}">
    <ControlTemplate.Resources>
      <Storyboard x:Key="OnMouseEnter1">

        <ThicknessAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="border" Storyboard.TargetProperty="(Border.BorderThickness)">
          <SplineThicknessKeyFrame KeyTime="00:00:00" Value="1"/>
        </ThicknessAnimationUsingKeyFrames>
      </Storyboard>
      <Storyboard x:Key="OnMouseLeave1">
        <ThicknessAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="border" Storyboard.TargetProperty="(Border.BorderThickness)">
          <SplineThicknessKeyFrame KeyTime="00:00:00" Value="0"/>
        </ThicknessAnimationUsingKeyFrames>
      </Storyboard>
    </ControlTemplate.Resources>
    <Border Margin="0" Background="{TemplateBinding Background}" CornerRadius="3,3,3,3" BorderThickness="0" x:Name="border" BorderBrush="{TemplateBinding BorderBrush}">
      <Image   HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto" Height="Auto"  Margin="1"  >
        <Image.Source>
          <DrawingImage>
            <DrawingImage.Drawing>
              <DrawingGroup>
                <!-- Triangle -->
                <GeometryDrawing >
                  <GeometryDrawing.Brush>
                    White
                  </GeometryDrawing.Brush>
                  <GeometryDrawing.Pen>
                    <Pen Brush="{DynamicResource IconBrush}" Thickness="5" StartLineCap="Round" EndLineCap="Round" LineJoin="Round"/>
                  </GeometryDrawing.Pen>
                  <GeometryDrawing.Geometry>
                    <GeometryGroup>
                      <PathGeometry Figures="M100,40 L100,100 L40,100 z" />
                    </GeometryGroup>
                  </GeometryDrawing.Geometry>
                </GeometryDrawing>
                <!--Edge-->
                <GeometryDrawing >
                  <GeometryDrawing.Pen>
                    <Pen Brush="{DynamicResource IconBrush}" Thickness="10" StartLineCap="Round" EndLineCap="Round" LineJoin="Round"/>
                  </GeometryDrawing.Pen>
                  <GeometryDrawing.Geometry>
                    <GeometryGroup>
                      <PathGeometry Figures="M100,0 L0,0 L0,100"/>
                      <PathGeometry Figures="M35,35 L80,80"/>
                    </GeometryGroup>
                  </GeometryDrawing.Geometry>
                </GeometryDrawing>
              </DrawingGroup>         
            </DrawingImage.Drawing>
          </DrawingImage>
        </Image.Source>
      </Image>
    </Border>
    <ControlTemplate.Triggers>
      <EventTrigger RoutedEvent="Mouse.MouseEnter">
        <EventTrigger.Actions>
          <BeginStoryboard Storyboard="{StaticResource OnMouseEnter1}"/>
        </EventTrigger.Actions>
      </EventTrigger>

      <EventTrigger RoutedEvent="Mouse.MouseLeave">
        <EventTrigger.Actions>
          <BeginStoryboard Storyboard="{StaticResource OnMouseLeave1}"/>
        </EventTrigger.Actions>
      </EventTrigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>

  <!--Style for the group box of the ribbon. The group box appears as a sub-level of the tabs and groups the ribbon buttons.-->
  <Style TargetType="{x:Type GroupBox}">
    <Setter Property="SnapsToDevicePixels" Value="True"/>
    <Setter Property="OverridesDefaultStyle" Value="True"/>
    <Setter Property="Margin" Value="2"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type GroupBox}">
          <Border
                Background="{StaticResource NormalBackgroundBrush}"
                BorderBrush="{StaticResource GroupBoxOuterBorderBrush}"
                BorderThickness="1"
                CornerRadius="3"
                SnapsToDevicePixels="True">
            <Grid>
              <Grid.RowDefinitions>
                <RowDefinition Height="*"/>
                <RowDefinition Height="Auto"/>
              </Grid.RowDefinitions>
              <Border
                BorderBrush="{StaticResource GroupBoxInnerBorderBrush}"
                BorderThickness="1,1,0,0"
                CornerRadius="3,3,0,0"
                Margin="1"
                SnapsToDevicePixels="True">
                <DockPanel >
                  <ContentPresenter Margin="2" ContentSource="Content" >
                  </ContentPresenter>
                </DockPanel>


              </Border>
              <Border
                Grid.Row="1"
                Background="#C1D9F1"
                BorderThickness="1,0,1,1"
                CornerRadius="0,0,3,3"
                Margin="-1"
                SnapsToDevicePixels="True"
                Name="HeaderBorder">

                <Grid  Margin="0,0,5,0" >
                  <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="0.95*"/>
                    <ColumnDefinition Width="0.05*"/>
                  </Grid.ColumnDefinitions>
                  <ContentPresenter
                                      Margin="2"
                                      HorizontalAlignment="Center"
                                      VerticalAlignment="Center"
                                      ContentSource="Header"
                                      Name="PART_HeaderSite"
                                      RecognizesAccessKey="True"
                                      TextElement.Foreground="{StaticResource NormalForegroundBrush}"/>
                  <Button  HorizontalAlignment="Center" Margin="0,0,0,0" Grid.Column="1"  Width="3" Height="3"  Background="Transparent" BorderBrush="Black"  >

                  </Button>
                </Grid>
              </Border>

            </Grid>
          </Border>
          <ControlTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
              <Setter Property="Background" TargetName="HeaderBorder" Value="{StaticResource GroupBoxHighlightBackgroundBrush}"/>
              <Setter Property="TextElement.Foreground" TargetName="PART_HeaderSite" Value="{StaticResource GroupBoxHighlightForegroundBrush}"/>
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
</ResourceDictionary>